home *** CD-ROM | disk | FTP | other *** search
- # ┌──────────────────────────────────────────────────────────────────────────┐
- # │ BLACKJ11.SRC (Chuckle Box BlackJack) │
- # │ │
- # │ Version: 1.1 (Released 11 Mar 1996) for SBBS 2.20 - Rev B │
- # │ Author: Robert Nykvist aka Chuckles@VERT │
- # │ │
- # │ Quick Start: 1. Move BLACKJ11.SRC to your \EXEC directory. │
- # │ 2. Compile BLACKJ11.SRC with BAJA compiler. │
- # │ 3. You know best how and where to put the script. │
- # │ │
- # │ NOTE: This script WILL modify the BBS Log, │
- # │ and User Credit amounts. │
- # └──────────────────────────────────────────────────────────────────────────┘
-
- # ┌─────────────────────────────────────┐
- # │ Let other nodes know where user is. │
- # └─────────────────────────────────────┘
- !include nodedefs.inc
-
-
- #┌──────────────────────────┐
- #│ Define Integer Variables │
- #└──────────────────────────┘
- int WINNINGS
- int CARD
- int COUNT
- int TOTAL
- int COUNT
-
-
- # ┌─────────────────────────────────────────────────────┐
- # │ Set WINNINGS to zero only upon entering the script. │
- # └─────────────────────────────────────────────────────┘
- set WINNINGS 0
-
-
- # ┌───────────────────────────────────────────────────────────┐
- # │ Top of Menu - Credit Check │
- # │ If user doesn't have 5 k Credits, send them on their way. │
- # └───────────────────────────────────────────────────────────┘
- :top
- compare_ars $C !5
- if_true
- print "\r\nrhSorry, you don't have enough credits play today.\r\n"
- print "rhTry again tomorrow...n\r\n"
- crlf
- pause
- goto byebye
- end_if
-
-
- # ┌──────────────┐
- # │ Display Menu │
- # └──────────────┘
- cls
- print " hw4 Score Result n\r\n
- print "n ┌────────────┬────────────┐\r\n"
- print " │ hm2 - 8 n│ hm-25 k n│"
- print " nhwChuckle Box BlackJackn\r\n
- print " │ hm9 - 13 n│ hm-10 k n│"
- print " hy Version 1.1n\r\n"
- print " │ hg14 - 17 n│ hg+5 k n│\r\n"
- print " │ hg18 - 20 n│ hg+25 k n│"
- print " 4hy Your Credits :w @BYTESLEFT@ n\r\n"
- print " │ hyBlack Jack n│ hy+50 k n│\r\n"
- print " │ hrBusted n│ hr-25 k n│\r\n"
- print " └────────────┴────────────┘n\r\n"
- crlf
-
-
- # ┌────────────────────────────────────────────────────────────┐
- # │ Note Node Location & make sure things are flowing in SYNC. │
- # └────────────────────────────────────────────────────────────┘
- node_action node_xtrn
- async
-
-
- # ┌────────────────┐
- # │ Display Prompt │
- # └────────────────┘
- mnemonics " (~I)nfo, (~P)lay or (~Q)uit > "
-
-
- # ┌─────────────────────────────────────────┐
- # │ Get Key Input From User - ENTER allowed │
- # └─────────────────────────────────────────┘
- getkey IPQ?\R
-
-
- # ┌───────────────────────────┐
- # │ Display Instructions/Info │
- # └───────────────────────────┘
- cmdkey I
- cls
- crlf
- crlf
- print "ònhChuckle Box BlackJack - Ver 1.1\r\n"
- print "öyby Robert Nykvist (Copyright)1996\r\n"
- crlf
- crlf
- print "ìnc Each BlackJack hand costsihr 5 knc credits!\r\n"
- print "ìncWhen you hHITnc, the hmcomputer ncwill deal you a card,\r\n"
- print "ïand keep a running htotal ncof the value of your hHITsnc.\r\n"
- crlf
- print "ÜFace card = face value.\r\n"
- print "önc Jack = hm11, ncQueen = 12, King = 13\r\n"
- crlf
- print "ìWhen you hSTOP nchitting, the computer will hmprocess\r\n"
- print "ènc credits according to the chart ncin the menu.\r\n"
- crlf
- print "âCredits can hbuy ncyou hmextra ncon-line time using the Time/Credit hmBanknc!n\r\n"
- crlf
- crlf
- pause
- goto top
- end_cmd
-
-
- # ┌─────────────────────────────────────┐
- # │ Wipe out display Prompt and go Play │
- # └─────────────────────────────────────┘
- cmdkey P
- print "1Hn n\r\n"
- goto play
- end_cmd
-
-
- # ┌───────────────────────────────────┐
- # │ Wipe out display Prompt and Leave │
- # └───────────────────────────────────┘
- cmdkey Q
- print "1Hn n\r\n"
- goto leave
- end_cmd
- print "1Hn n\r\n"
-
-
- # ┌───────────────────────────────────────────┐
- # │ Hitting Enter or fallthrough goes to Play │
- # └───────────────────────────────────────────┘
- print "1Hn n\r\n"
- goto play
-
-
- # ┌──────────────────────────────────────────────────┐
- # │ Play BlackJack - Adjust Credits -5K for Ante, │
- # │ Keep track of WINNINGS, Reset Integer variables. │
- # └──────────────────────────────────────────────────┘
- :play
- adjust_user_credits -5
- add WINNINGS -5
- set CARD 0
- set COUNT 0
- set TOTAL 0
-
-
- # ┌──────────────────────────────────────────────────┐
- # │ Switch/Case Loop using Integer Variable COUNT. │
- # │ Purpose is to alter prompt colors after each hit │
- # │ while updating totals. Easier for user to see. │
- # │ Many ANSI sequences used to control placement. │
- # └──────────────────────────────────────────────────┘
- :choosecard
- switch count
- case 0
- print "1H"
- print "hcYour current score is: hm"
- print TOTAL
- print "1H"
- print " "
- print "1H"
- yes_no "Hit"
- if_true
- goto hit
- else
- goto stay
- end_if
- end_case
- case 1
- print "1H"
- print "hyYour current score is: hc"
- print TOTAL
- print "1H"
- print " "
- print "1H"
- yes_no "Hit"
- if_true
- goto hit
- else
- goto stay
- end_if
- end_case
- case 2
- print "1H"
- print "nmYour current score is: hy"
- print TOTAL
- print "1H"
- print " "
- print "1H"
- yes_no "Hit"
- if_true
- goto hit
- else
- goto stay
- end_if
- end_case
- case 3
- print "1H"
- print "hcYour current score is: hm"
- print TOTAL
- print "1H"
- print " "
- print "1H"
- yes_no "Hit"
- if_true
- goto hit
- else
- goto stay
- end_if
- end_case
- case 4
- print "1H"
- print "hgYour current score is: nc"
- print TOTAL
- print "1H"
- print " "
- print "1H"
- yes_no "Hit"
- if_true
- goto hit
- else
- goto stay
- end_if
- end_case
- case 5
- print "1H"
- print "hmYour current score is: nc"
- print TOTAL
- print "1H"
- print " "
- print "1H"
- yes_no "Hit"
- if_true
- goto hit
- else
- goto stay
- end_if
- end_case
- end_switch
-
-
- # ┌────────────────────────────────────────┐
- # │ Player wants a Hit (Draw Card) │
- # │ Randomly choose 1-13 for CARD variable │
- # │ 0-12 becomes 1-13 by adding 1. │
- # └────────────────────────────────────────┘
- :hit
- random CARD 12
- add CARD 1
-
-
- # ┌──────────────────────────────────────────────────────┐
- # │ Problem here is displaying cards with single digits │
- # │ as compared to double digit cards, not to mention │
- # │ a standard placement of each card for nice graphics. │
- # │ Making use of Switch/Case loop, again using COUNT, │
- # │ and ANSI sequence codes to control placement. │
- # └──────────────────────────────────────────────────────┘
- :displaycard
- switch count
- case 0
-
-
- # ┌──────────────────────────────────────────────┐
- # │ Is the card two digit or single digit? │
- # │ Double Digit card is one character wider... │
- # │ That's the reason for this long case/if loop │
- # └──────────────────────────────────────────────┘
- compare CARD 10
- if_less
-
-
- # ┌──────────────────────────────────────────────┐
- # │ Display first card Hit on column 1 (1H) │
- # │ This is assuming a 24 x 80 character screen. │
- # └──────────────────────────────────────────────┘
- print "1H"
- print "hb╒════════╕ "
- print "1H"
- print "b│ c "
- print CARD
- print "b │ "
- print "1H"
- print "b│ │ "
- print "1H"
- # ┌─────────────────────────────────────────────┐
- # │ Letters CB? Chuckle Box of course. :) │
- # │ Customize this script as you see fit. │
- # │ But kindly give credit where credit is due. │
- # └─────────────────────────────────────────────┘
- print "b│ CB │ "
- print "1H"
- print "b│ │ "
- print "1H"
- print "b│ c"
- print CARD
- print "b │ "
- print "1H"
- print "b╘════════╛ "
- print "1H"
- print "wThe card is a: g"
- print CARD
- print " "
- else
- print "1H"
- print "hb╒═════════╕ "
- print "1H"
- print "b│ c "
- print CARD
- print "b │ "
- print "1H"
- print "b│ │ "
- print "1H"
- print "b│ C B │ "
- print "1H"
- print "b│ │ "
- print "1H"
- print "b│ c"
- print CARD
- print "b │ "
- print "1H"
- print "b╘═════════╛ "
- print "1H"
- print "yThe card is a: c"
- print CARD
- print " "
- end_if
- end_case
- case 1
- compare CARD 10
- if_less
- # ┌─────────────────────────────────────────────┐
- # │ Display second card hit on column 15 (15H) │
- # └─────────────────────────────────────────────┘
- print "15H"
- print "hb╒════════╕ "
- print "15H"
- print "b│ c "
- print CARD
- print "b │ "
- print "15H"
- print "b│ │ "
- print "15H"
- print "b│ CB │ "
- print "15H"
- print "b│ │ "
- print "15H"
- print "b│ c"
- print CARD
- print "b │ "
- print "15H"
- print "b╘════════╛ "
- print "1H"
- print "wThe card is a: g"
- print CARD
- print " "
- else
- print "15H"
- print "hb╒═════════╕ "
- print "15H"
- print "b│ c"
- print CARD
- print "b │ "
- print "15H"
- print "b│ │ "
- print "15H"
- print "b│ C B │ "
- print "15H"
- print "b│ │ "
- print "15H"
- print "b│ c"
- print CARD
- print "b │ "
- print "15H"
- print "b╘═════════╛ "
- print "1H"
- print "yThe card is a: c"
- print CARD
- print " "
- end_if
- end_case
- case 2
- compare CARD 10
- if_less
- # ┌────────────────────────────────────────────┐
- # │ Display third card hit on column 30 (30H) │
- # └────────────────────────────────────────────┘
- print "30H"
- print "hb╒════════╕ "
- print "30H"
- print "b│ c "
- print CARD
- print "b │ "
- print "30H"
- print "b│ │ "
- print "30H"
- print "b│ CB │ "
- print "30H"
- print "b│ │ "
- print "30H"
- print "b│c "
- print CARD
- print "b │ "
- print "30H"
- print "b╘════════╛ "
- print "1H"
- print "wThe card is a: g"
- print CARD
- print " "
- else
- print "30H"
- print "hb╒═════════╕ "
- print "30H"
- print "b│ c"
- print CARD
- print "b │ "
- print "30H"
- print "b│ │ "
- print "30H"
- print "b│ C B │ "
- print "30H"
- print "b│ │ "
- print "30H"
- print "b│ c"
- print CARD
- print "b │ "
- print "30H"
- print "b╘═════════╛ "
- print "1H"
- print "yThe card is a: c"
- print CARD
- print " "
- end_if
- end_case
- case 3
- compare CARD 10
- if_less
- # ┌────────────────────────────────────────────┐
- # │ Display fourth card hit on column 45 (45H) │
- # └────────────────────────────────────────────┘
- print "45H"
- print "hb╒════════╕ "
- print "45H"
- print "b│ c "
- print CARD
- print "b │ "
- print "45H"
- print "b│ │ "
- print "45H"
- print "b│ CB │ "
- print "45H"
- print "b│ │ "
- print "45H"
- print "b│ c"
- print CARD
- print "b │ "
- print "45H"
- print "b╘════════╛ "
- print "1H"
- print "wThe card is a: g"
- print CARD
- print " "
- else
- print "45H"
- print "hb╒═════════╕ "
- print "45H"
- print "b│ c"
- print CARD
- print "b │ "
- print "45H"
- print "b│ │ "
- print "45H"
- print "b│ C B │ "
- print "45H"
- print "b│ │ "
- print "45H"
- print "b│ c"
- print CARD
- print "b │ "
- print "45H"
- print "b╘═════════╛ "
- print "1H"
- print "yThe card is a: c"
- print CARD
- print " "
- end_if
- end_case
- case 4
- compare CARD 10
- if_less
- # ┌────────────────────────────────────────────────────┐
- # │ Display fifth & last card pick on column 60 (60H) │
- # └────────────────────────────────────────────────────┘
- print "60H"
- print "hb╒════════╕ "
- print "60H"
- print "b│ c "
- print CARD
- print "b │ "
- print "60H"
- print "b│ │ "
- print "60H"
- print "b│ CB │ "
- print "60H"
- print "b│ │ "
- print "60H"
- print "b│c "
- print CARD
- print "b │ "
- print "60H"
- print "b╘════════╛ "
- print "1H"
- print "wThe card is a: g"
- print CARD
- print " "
- else
- print "60H"
- print "hb╒═════════╕ "
- print "60H"
- print "b│ c"
- print CARD
- print "b │ "
- print "60H"
- print "b│ │ "
- print "60H"
- print "b│ C B │ "
- print "60H"
- print "b│ │ "
- print "60H"
- print "b│ c"
- print CARD
- print "b │ "
- print "60H"
- print "b╘═════════╛ "
- print "1H"
- print "yThe card is a: c"
- print CARD
- print " "
- end_if
- end_case
- end_switch
-
-
- # ┌────────────────────────────────────────────────────────┐
- # │ COUNT is used to keep track of Hits or cards drawn. │
- # │ After drawing a CARD, it is added to variable TOTAL. │
- # └────────────────────────────────────────────────────────┘
- add COUNT 1
- add TOTAL CARD
-
-
- # ┌─────────────────────────────────────────────┐
- # │ There is a BONUS for those who draw 5 cards │
- # │ Checking for it BIG winners here. │
- # └─────────────────────────────────────────────┘
- compare COUNT 5
- if_true
- goto bigtest
- end_if
-
-
- # ┌───────────────────────────────┐
- # │ Checking TOTAL for Blackjack. │
- # └───────────────────────────────┘
- compare TOTAL 21
- if_true
- goto super
- end_if
-
-
- # ┌───────────────────────────────────────────────────────┐
- # │ Is TOTAL less than 21? See if they want another HIT. │
- # └───────────────────────────────────────────────────────┘
- compare TOTAL 21
- if_less
- goto choosecard
- end_if
-
-
- # ┌─────────────────────────────────────┐
- # │ TOTAL over 21? Oh Crap... BUSTED. │
- # └─────────────────────────────────────┘
- compare TOTAL 21
- if_greater
- goto crap
- end_if
-
-
- # ┌───────────────────────────────────────────────┐
- # │ When they don't want another HIT - they STAY. │
- # │ Now we have to determine what CREDIT action │
- # │ to take based upon their card TOTAL. │
- # │ See Menu for what TOTALs earn what CREDITS. │
- # │ Free to customize the CREDIT structures. │
- # │ Checking here for a TOTAL less than 8. │
- # └───────────────────────────────────────────────┘
- :stay
- compare TOTAL 8
- if_less_or_equal
- goto losetwofive
- else
- goto testtwo
- end_if
-
-
- # ┌─────────────────────────────────┐
- # │ TOTAL Less than 8? Yikes! -25 │
- # └─────────────────────────────────┘
- :losetwofive
- print "1H"
- print "hwYour total for this hand was: hb"
- print TOTAL
- print " n\r\n"
- print " n\r\n"
- print "hmThe SysOp Chuckles as he snatches hr25 khm of your credits!n\r\n"
- print "1Hn n"
- pause
-
-
- # ┌────────────────────────────────────────────────────────────┐
- # │ Keeping constant updates on CREDITS, and overall WINNINGS. │
- # └────────────────────────────────────────────────────────────┘
- adjust_user_credits -25
- add WINNINGS -25
- goto top
-
-
- # ┌───────────────────────────────────┐
- # │ Checking for TOTAL between 9 & 13 │
- # └───────────────────────────────────┘
- :testtwo
- compare TOTAL 13
- if_less_or_equal
- goto loseten
- else
- goto testthree
- end_if
-
-
- # ┌────────────────────────────────────┐
- # │ TOTAL between 9-13. Too Bad. -10 │
- # └────────────────────────────────────┘
- :loseten
- print "1H"
- print "hwYour total for this hand was: hb"
- print TOTAL
- print " n\r\n"
- print " n\r\n"
- Print "hmSay goodbye to hr10 khm of your Credits for staying with 13 or less!n\r\n"
- print "1Hn n"
- pause
- adjust_user_credits -10
- add WINNINGS -10
- goto top
-
-
- # ┌────────────────────────────────────┐
- # │ Checking for TOTAL between 14 & 17 │
- # └────────────────────────────────────┘
- :testthree
- compare TOTAL 17
- if_less_or_equal
- goto gainfive
- else
- goto testfour
- end_if
-
-
- # ┌─────────────────────────────────────────────────────┐
- # │ TOTAL between 14-17. They played it SAFE. +5 │
- # │ Since it cost 5 to play, they gain or lose nothing. │
- # └─────────────────────────────────────────────────────┘
- :gainfive
- print "1H"
- print "hwYour total for this hand was: hb"
- print TOTAL
- print " n\r\n"
- print " n\r\n"
- print "hmSmart Move! Playing it safe earned youhr 5 khm Credits.n\r\n"
- print "1Hn n"
- pause
- adjust_user_credits 5
- add WINNINGS 5
- goto top
-
-
- # ┌───────────────────────────────────────────┐
- # │ TOTAL between 18-20. Ahh, a Winner! +25 │
- # └───────────────────────────────────────────┘
- :testfour
- print "1H"
- print "hwYour total for this hand was: hb"
- print TOTAL
- print " n\r\n"
- print " n\r\n"
- print "hmWow! What luck @USER@! You win r25 km Credits!!!!n\r\n"
- print "1Hn n"
- pause
- adjust_user_credits 25
- add WINNINGS 25
- goto top
-
-
- # ┌──────────────────────────────────────┐
- # │ TOTAL = 21 CHUCKLE BLACK JACK! +50 │
- # └──────────────────────────────────────┘
- :super
- print "1H"
- print "hwYour total for this hand was: hb"
- print TOTAL
- print " n\r\n"
- print " n\r\n"
- print "hmYou've hit 21-BLACKJACK you lucky hacker you!!!n\r\n"
- print "hyThe SysOp addsr 50 ky credits to your account with a scowl...n\r\n"
- print "1Hn n"
- pause
- adjust_user_credits 50
- add WINNINGS 50
- goto top
-
-
- # ┌────────────────────────────────────────────┐
- # │ Took 5 cards and the TOTAL was 21 or less? │
- # │ Not easy to do so reward them! +150 │
- # └────────────────────────────────────────────┘
- :overfive
- print "1H"
- print "hwYour total for this hand was: hb"
- print TOTAL
- print " n\r\n"
- print " n\r\n"
- print "hmYou took 5 cards and have 21 or less. You get Bonus Credits!!!n\r\n"
- print "hyThe SysOp painfully addsr 150 ky credits to your account with a howl...n\r\n"
- print "1Hn n"
- pause
- adjust_user_credits 150
- add WINNINGS 150
- goto top
-
-
- # ┌───────────────────────────────┐
- # │ TOTAL over 21. BUSTED! -25 │
- # └───────────────────────────────┘
- :crap
- print "1H"
- print "hwYour total for this hand was: hb"
- print TOTAL
- print " n\r\n"
- print " n\r\n"
- print "hmUh Oh . . . You've busted big time with a score of: hr"
- print TOTAL
- print ".n\r\n"
- print "hyThe SysOp pockets away r25 ky of your credits with a Chuckle...n\r\n"
- print "1Hn n"
- pause
- adjust_user_credits -25
- add WINNINGS -25
- goto top
-
-
- # ┌────────────────────────────────────────────────────────────────┐
- # │ If COUNT in a previous check indicated 5 cards had been drawn, │
- # │ this is the bigtest to see if they win big CREDITS. │
- # └────────────────────────────────────────────────────────────────┘
- :bigtest
- compare TOTAL 21
- if_less_or_equal
- goto overfive
- end_if
- compare TOTAL 21
- if_greater
- goto crap
- end_if
-
-
- # ┌──────────────────────────────────────────────────┐
- # │ Leaving so soon? Let's see if they won or lost │
- # │ and send them the appropriate feedback. │
- # │ They started out with WINNINGS = 0 │
- # └──────────────────────────────────────────────────┘
- :leave
- compare WINNINGS 0
- if_equal
- goto nochange
- end_if
- compare WINNINGS 0
- if_greater
- goto playerwon
- else
- goto userlost
- end_if
-
-
- # ┌───────────────────────┐
- # │ No winings - No loss. │
- # └───────────────────────┘
- :nochange
- cls
- crlf
- crlf
- print "hyYou came out exactly hmEVENhy @USER@.n\r\n"
- crlf
- pause
- goto byebye
-
-
- # ┌────────────────────────────────────────┐
- # │ TOTAL above zero - Player Won Credits! │
- # └────────────────────────────────────────┘
- :playerwon
- cls
- crlf
- crlf
- print "hyYou've won a grand total of hm"
- print WINNINGS
- print " hyk Credits @USER@.n\r\n
- crlf
- pause
- goto byebye
-
-
- # ┌──────────────────────────────────────┐
- # │ TOTAL below 0 (negative) User Lost! │
- # └──────────────────────────────────────┘
- :userlost
- cls
- crlf
- crlf
- print "hyYou lost a total of hm"
- print WINNINGS
- print " hyk Credits @USER@n\r\n"
- crlf
- pause
- goto byebye
-
-
- # ┌────────────────────────────────────────────────┐
- # │ Exiting Script. │
- # │ Keep track of Player's overall success in log. │
- # └────────────────────────────────────────────────┘
- :byebye
- log "$+ credit adjustment : "
- log "%s" WINNINGS
-